<?php
@session_start();
include "../../../jerimum/classes/bd.php";
include "../../../jerimum/classes/descrever.php";

$_des 	= new descrever();

$acao	= $_REQUEST["acao"];
$id		= $_REQUEST["id"];
$dados	= $_des->pega($id);

if($_SESSION['idcliente'] != $dados["idcliente"]){ die("Sem permi&ccedil;&atilde;o para realizar esta a&ccedil;&atilde;o.");}


switch($acao){
			
		
		
		case "aceito":
		$_des->id		= $id;
		$_des->ativo 	= 1;
		$ativa	= $_des->status();
		
		if($ativa){
		#echo "ok";
		header("Location: detalhes.php?descricao=".$id."");
		}else{
		#echo "erro";
		print mysql_error();
		}
		
		break;
		

		case "pedente":
		$_des->id		= $id;
		$_des->ativo 	= 0;
		$ativa	= $_des->status();
		
		if($ativa){
		header("Location: detalhes.php?descricao=".$id."");
		}else{
		#echo "erro";
		print mysql_error();
		}
		
		break;



		case "apagar":
		$_des->id		= $id;
		$finalizar		= $_des->deleta();
		if($finalizar){
		?>
        <script type="text/javascript">
		window.opener.location.href="/painel.php?acao=descricao";
		window.close();
		</script>
        <?
		}else{
		print mysql_error();
		}
		
		break;
		
	
		
		
		
		
		
}


?>